<?php $this->_extends('../_layouts/blank_layout'); ?>

<?php $this->_block('contents'); ?>

<div class="tasks">
<?php
// user_id, group_id, account, user_name, password, ipzone, email, mobile, phone, join_day, dimission_day, birthday,
// created, updated, is_locked, register_ip, last_login, last_login_ip, login_count
// group_id, parent_id, group_name, left_value, right_value, description, has_users
// role_id rolename description user_owned group_owned
//$show_box['user_info']
?>
<h1><?php echo $show_box['title'];?></h1>
<table cellSpacing="0" cellPadding="3" align="center" border="0" width="100%">
    <tr><td align="left" class='bgTitle'>用户组ID</td>    	<td align="left" ><?php echo $show_box['group_info']['group_id'];?></td></tr>
	<tr><td align="left" class='bgTitle'>上级ID</td>    	<td align="left" ><?php echo $show_box['group_info']['parent_id'];?></td></tr>
    <tr><td align="left" class='bgTitle'>用户组名</td>     	<td align="left" ><?php echo $show_box['group_info']['group_name'];?></td></tr>
    <tr><td align="left" class='bgTitle'>成员数</td>  		<td align="left" ><?php echo $show_box['group_info']['has_users'];?></td></tr>
</table>
</div>

<div > deny 暂时无用</div>
<form name="form_roleaddform" action="<?php echo url('admin::groups/bind')?>" method="post" enctype="application/x-www-form-urlencoded" >
<?php
$form_elements = '';
foreach ( $show_box['roles'] as $value){
    //$checked = in_array($value['role_id'],$show_box['user_roles']) ? ' checked="checked"':'';
    if ( in_array($value['role_id'],$show_box['group_roles']['role_id']) ){
        if ($show_box['group_roles'][$value['role_id']]){
            $form_elements .= '<input type="radio" name="role_id['.$value['role_id'].']" value="1" checked="checked"/>allow';
            $form_elements .= '<input type="radio" name="role_id['.$value['role_id'].']" value="0" />deny';
        }else{
            $form_elements .= '<input type="radio" name="role_id['.$value['role_id'].']" value="1" />allow';
            $form_elements .= '<input type="radio" name="role_id['.$value['role_id'].']" value="0" checked="checked"/>deny';
        }
        $form_elements .= '<input type="radio" name="role_id['.$value['role_id'].']" value="n" />null';
    }else{
        $form_elements .= '<input type="radio" name="role_id['.$value['role_id'].']" value="1" />allow';
        $form_elements .= '<input type="radio" name="role_id['.$value['role_id'].']" value="0" />deny';
        $form_elements .= '<input type="radio" name="role_id['.$value['role_id'].']" value="n" checked="checked"/>null';
    }
    $form_elements .= ' '.$value['role_id'].' '.$value['rolename'].' '.$value['description'].'<br />'."\n";
}
echo $form_elements;
?>
    <input type="submit" name="btn_submit" value="提交" class="btn" />
    <input type="hidden" name="group_id" id="user_id" value="<?php echo $show_box['group_info']['group_id'];?>" />
</form>



<?php //$this->_element('../../_elements/formview_simple', array('form' => $show_box['form'])); ?>
<?php //dump($show_box['group_roles']);?>
<?php //dump($show_box['roles']);?>

<?php $this->_endblock(); ?>